package com.zsk.shop.controller.app;

import com.zsk.shop.common.annotion.NoPermission;
import com.zsk.shop.common.base.BaseResponse;
import com.zsk.shop.exception.ServiceException;
import com.zsk.shop.model.vo.ImageVerificationVo;
import com.zsk.shop.service.CaptchaServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description: 滑动验证码
 * -------------------
 * @Author: Ys
 * @Date: 2022/03/02 17:01
 */

@RestController
@Api(tags = "APP商城-滑动块验证码")
@RequestMapping("/captcha")
public class CaptchaController {

    /**
     * 运算码业务处理对象
     */
    @Resource
    private CaptchaServiceImpl captchaService;

    /**
     * 获取验证码
     * @return 根据类型参数返回验证码
     */
    @NoPermission
    @PostMapping("/image.do")
    @ApiOperation("获取验证码")
    public BaseResponse<ImageVerificationVo> getVerificationImage() throws ServiceException {
        return captchaService.selectSlideVerificationCode();
    }

}